package com.ruoyi.huanghefd.controller;

import com.ruoyi.huanghefd.utils.PageBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.huanghefd.service.twoticketsService;

import javax.annotation.Resource;

/**
 * @Author gnplum
 * @Date 2024/1/5 0:00
 * @PackageName:com.ruoyi.huanghefd.controller
 * @ClassName: twoticketsController
 * @Description: TODO
 * @Version 1.0
 */
@RestController
@RequestMapping("/huanghefd")
public class twoticketsController {
    private static final Logger log = LoggerFactory.getLogger(twoticketsController.class);

    @Resource
    private twoticketsService twoticketsService;

    @PostMapping(value = "/twoticketsQuery")
    public PageBean twoticketsQueryList(@RequestParam(value = "ticketSort")String ticketSort,//两票查询类型： 1-工作票查询 2-操作票查询
                                        @RequestParam(required = false, value = "ticketCode")String ticketCode,
                                        @RequestParam(required = false, value = "ticketName")String ticketName,
                                        @RequestParam(required = false, value = "ticketType")String ticketType,
                                        @RequestParam(required = false, value = "ticketState")String ticketState,
                                        @RequestParam(required = false, value = "planStarttime")String planStarttime,
                                        @RequestParam(required = false, value = "planEndtime")String planEndtime,
                                        @RequestParam(required = false, value = "isTimeout")String isTimeout,//是否超期，0-否 1-是
                                        @RequestParam(required = false, value = "dept")String dept,//制票单位
                                        @RequestParam(required = false, value = "principal")String principal,//工作票负责人
                                        @RequestParam(value = "pageNum")int pageNum,
                                        @RequestParam(value = "pageSize")int pageSize) {
        log.info(">> 两票查询-入参==" + ticketSort + "," + ticketCode + "," + ticketName + "," + ticketType + "," + ticketState + "," + planStarttime + "," + planEndtime+ "," + dept+ "," + principal);
        PageBean ajax = twoticketsService.twoticketsQuery(ticketSort, ticketCode, ticketName, ticketType, ticketState, planStarttime, planEndtime, isTimeout, dept, principal, pageNum, pageSize);
        log.info(">> 两票查询-返回==" + ajax);
        return ajax;
    }
    @PostMapping(value = "/twoticketsTJQuery")
    public PageBean twoticketsTJQuery(@RequestParam(value = "ticketSort")String ticketSort,//两票查询类型： 1-工作票查询 2-操作票查询
                                        @RequestParam(required = false, value = "dept")String dept,
                                        @RequestParam(required = false, value = "ticketType")String ticketType,
                                        @RequestParam(required = false, value = "currYearNum")String currYearNum,
                                        @RequestParam(required = false, value = "currMonthNum")String currMonthNum,
                                        @RequestParam(value = "pageNum")int pageNum,
                                        @RequestParam(value = "pageSize")int pageSize) {
        log.info(">> 两票统计-入参==" + ticketSort + "," + dept + "," + ticketType + "," + currYearNum + "," + currMonthNum);
        PageBean ajax = twoticketsService.twoticketsTJQuery(ticketSort, dept, ticketType, currYearNum, currMonthNum, pageNum, pageSize);
        log.info(">> 两票统计-返回==" + ajax);
        return ajax;
    }
}
